<template>
    <div>
        <h1>权益添加</h1>
        <table class="table">
            <tbody>
                <tr>
                    <td>权益名称</td>
                    <td><input type="text" v-model="info.userNoeName"></td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td>
                        <input type="radio" name="state" :value="1" v-model="info.state">启用
                        <input type="radio" name="state" :value="0" v-model="info.state">禁用
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="button" value="确定" @click="r"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import axios from 'axios';
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
const router = useRouter();

let info: any = reactive({
    "userNoeName": "",
    "state": '',
})
const r = () => {
    axios({
        url: 'https://localhost:7173/api/User/AddUserNoe',
        method: 'post',
        data: info,
    })
        .then(res => {
            if (res.data > 0) {
                alert("添加成功");
                return;
            }
            else if (res.data == -1) {
                alert("不要重复添加权益");
                return;
            }
            else {
                alert("添加失败");
                return;
            }
        })
}


</script>

<style scoped></style>